home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -serious- / programming / other / tandem / teaching / 28.asm < prev    next >
Assembly Source File  |  1999-09-06  |  2KB  |  60 lines

  1. * 28.asm    Demonstrate TLstring, TLtrim      Version 0.01    8.6.97
  2.  
  3. ; This program prints a message to a custom window, using TLstring. You
  4. ; should follow this carefully, noting the use of an embedded IntuiText
  5. ; structure by TLTrim, which TLstring calls. (See Intuition/Intuition.i)
  6. ; Change "include 'Front.i'"  (below) to  "include 'Tandem.i'" to step
  7. ; thru the TL routines.
  8.  
  9. ; You will notice that if you resize a window over its text, the resized-
  10. ; over text blanks out. I will explain "refreshing" in a future program,
  11. ; which overcomes this problem. tandem.library opens "smart refresh" windows
  12. ; which re-display (refresh) themselves automatically if one dumps another
  13. ; window on top of them. But only "super bitmap" windows refresh themselves
  14. ; if they are resized. Super bitmap windows are rarely used since they are
  15. ; slow and waste memory.
  16.  
  17. ; This program does not call TLscreen, to it shares the default public
  18. ; screen (i.e. generally the workbench).
  19.  
  20. ; You will note in the program below that you do not need to close
  21. ; windows or other things created by tandem.library calls. Front.i calls
  22. ; TLWclose when you exit from Program, which automatically releases
  23. ; all resources used by tandem.library calls. This makes programming
  24. ; more convenient.
  25.  
  26.  
  27.  include 'Front.i'       ;*** change to 'Tandem.i' to step thru TL's ***
  28.  
  29.  
  30. strings: dc.b 0
  31. st_1: dc.b 'Demonstrate TLstring & TLtrim',0 ;1
  32.  dc.b 'Hello, Intuition',0 ;2
  33.  dc.b '28.asm failed: Out of memory',0 ;3
  34.  dc.b '(I don''t refresh - resize the window & see what I mean.)',0 ;4
  35.  dc.b 'Click the window close gadget when finished.',0 ;5
  36.  ds.w 0
  37.  
  38.  
  39. * open window & print message; close & exit when close gadget clicked
  40. Program:
  41.  TLwindow #0,#20,#10,#80,#50,#500,#150,#0,#st_1 ;open window 0
  42.  beq Pr_bad
  43.  
  44.  TLstring #2,#4,#2         ;show string 2 at (4,2)
  45.  TLstring #4,#4,#16        ;show string 4 at (4,16)
  46.  TLstring #5,#4,#30        ;show string 5 at (4,30)
  47.  
  48. Pr_wait:
  49.  TLkeyboard                ;get any input
  50.  cmp.b #$93,d0             ;close gadget?
  51.  bne Pr_wait               ;no, keep waiting
  52.  bra.s Pr_quit             ;return ok  (Front0.i closes everything)
  53.  
  54. Pr_bad:
  55.  TLerror                   ;TLerror sends error reports to the monitor
  56.  TLbad #3                  ;"TLbad #3" makes the monitor wait for
  57.                            ;  acknowledge before closing, with
  58. Pr_quit:
  59.  rts
  60.